package router

import (
	"ginstudydemo.com/main/controllers"
	"ginstudydemo.com/main/middleware"
	"github.com/gin-gonic/gin"
)

// AuthRouter  函数定义了 /book 路由组及其处理函数
func AuthRouter(r *gin.Engine) {
	rGroup := r.Group("/auth")
	{

		//登录
		rGroup.POST("/login", controllers.NewAuthController().Login)

		// 通过刷新token获取新的token
		rGroup.GET("/reToken", controllers.NewAuthController().RefreshTokenHandler)
		//注销
		rGroup.GET("/logout", middleware.NewJwtV5().JWTAuth(), controllers.NewAuthController().Logout)
		//生成新的验证码 ID 和 Base64 编码的验证码图片
		rGroup.GET("/captcha", controllers.NewCaptchaController().Generate)
		//验证验证码
		rGroup.POST("/checkCaptcha", controllers.NewCaptchaController().Verify)

	}

}
